<%@page import="cn.edu.pku.wxlib.recommendation.model.*" %>

<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib tagdir="/WEB-INF/tags/simpletable" prefix="simpletable"%>
<%@ include file="/commons/taglibs.jsp" %>

<rapid:override name="head">
	<title>Recommendation维护</title>
	
	<script src="${ctx}/scripts/rest.js" ></script>
	<link href="<c:url value="/widgets/simpletable/simpletable.css"/>" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="<c:url value="/widgets/simpletable/simpletable.js"/>"></script>
	
	<script type="text/javascript" >
		$(document).ready(function() {
			window.simpleTable = new SimpleTable('queryForm',${page.thisPageNumber},${page.pageSize},'${pageRequest.sortColumns}');
		});
	</script>
</rapid:override>

<rapid:override name="content">
	<form id="queryForm" name="queryForm" method="get" style="display: inline;">
	<div class="queryPanel">
		<fieldset>
			<table>
				<div class="form-group inline">
					<label>userId</label>	
					<input placeholder="请输入userId" value="${query.userId}" id="userId" name="userId" maxlength="10"  class="form-field"/>
					<br/>
				</div>
				<div class="form-group inline">
					<label>createTime</label>	
					<input type="text" value="<fmt:formatDate value='${query.createTimeBegin}' pattern='<%=Recommendation.FORMAT_CREATE_TIME%>'/>" id="createTimeBegin" name="createTimeBegin" class="query-date-picker"  />
					<strong>至</strong>
					<input type="text" value="<fmt:formatDate value='${query.createTimeEnd}' pattern='<%=Recommendation.FORMAT_CREATE_TIME%>'/>"  id="createTimeEnd" name="createTimeEnd" class="query-date-picker"   />
					<br/>
				</div>
				<div class="form-group inline">
					<label>1未处理，2购买，3拒绝</label>	
					<input placeholder="请输入1未处理，2购买，3拒绝" value="${query.state}" id="state" name="state" maxlength="10"  class="form-field"/>
					<br/>
				</div>
				<div class="form-group inline">
					<label>书名/报刊名</label>	
					<input placeholder="请输入书名/报刊名" value="${query.name}" id="name" name="name" maxlength="128"  class="form-field"/>
					<br/>
				</div>
				<div class="form-group inline">
					<label>作者</label>	
					<input placeholder="请输入作者" value="${query.author}" id="author" name="author" maxlength="32"  class="form-field"/>
					<br/>
				</div>
				<div class="form-group inline">
					<label>出版社</label>	
					<input placeholder="请输入出版社" value="${query.publisher}" id="publisher" name="publisher" maxlength="64"  class="form-field"/>
					<br/>
				</div>
				<div class="form-group inline">
					<label>出版时间</label>	
					<input type="text" value="<fmt:formatDate value='${query.publishTimeBegin}' pattern='<%=Recommendation.FORMAT_PUBLISH_TIME%>'/>" id="publishTimeBegin" name="publishTimeBegin" class="query-date-picker"  />
					<strong>至</strong>
					<input type="text" value="<fmt:formatDate value='${query.publishTimeEnd}' pattern='<%=Recommendation.FORMAT_PUBLISH_TIME%>'/>"  id="publishTimeEnd" name="publishTimeEnd" class="query-date-picker"   />
					<br/>
				</div>
				<div class="form-group inline">
					<label>理由</label>	
					<input placeholder="请输入理由" value="${query.reason}" id="reason" name="reason" maxlength="256"  class="form-field"/>
					<br/>
				</div>
				<div class="form-group inline">
					<label>价格</label>	
					<input placeholder="请输入价格" value="${query.price}" id="price" name="price" maxlength="22"  class="form-field"/>
					<br/>
				</div>
				<div class="form-group inline">
					<label>备注</label>	
					<input placeholder="请输入备注" value="${query.remark}" id="remark" name="remark" maxlength="256"  class="form-field"/>
					<br/>
				</div>
				<div class="form-group inline">
					<label>来源</label>	
					<input placeholder="请输入来源" value="${query.source}" id="source" name="source" maxlength="64"  class="form-field"/>
					<br/>
				</div>
				<div class="form-group inline">
					<label>isbnorIssn</label>	
					<input placeholder="请输入isbnorIssn" value="${query.isbnorIssn}" id="isbnorIssn" name="isbnorIssn" maxlength="13"  class="form-field"/>
					<br/>
				</div>
			</table>
			<button type="button" class="btn btn-default" onclick="getReferenceForm(this).action='${ctx}/recommendation'">查询</button>
		</fieldset>
		<div class="handleControl">
			<button type="button" class="btn btn-default" onclick="window.location = '${ctx}/recommendation/new'">新增</button>
			<button type="button" class="btn btn-default" onclick="doRestBatchDelete('${ctx}/recommendation','items',document.forms.queryForm)">删除</button>
		<div>
	
	</div>
	
	<div class="gridTable">	
		<table width="100%"  border="0" cellspacing="0" class="table text-center">
		  <thead>			  
			  <tr>
				<th style="width:1px;"><input type="checkbox" onclick="setAllCheckboxState('items',this.checked)"></th>
				<th sortColumn="userId" >userId</th>
				<th sortColumn="createTime" >createTime</th>
				<th sortColumn="state" >1未处理，2购买，3拒绝</th>
				<th sortColumn="name" >书名/报刊名</th>
				<th sortColumn="author" >作者</th>
				<th sortColumn="publisher" >出版社</th>
				<th sortColumn="publishTime" >出版时间</th>
				<th sortColumn="reason" >理由</th>
				<th sortColumn="price" >价格</th>
				<th sortColumn="remark" >备注</th>
				<th sortColumn="source" >来源</th>
				<th sortColumn="ISBNOrISSN" >isbnorIssn</th>
				<th style="white-space:nowrap;">操作</th>
			  </tr>			  
		  </thead>
		  <tbody>
		  	  <c:forEach items="${page.result}" var="item" varStatus="status">
			  <tr class="${status.count % 2 == 0 ? 'odd' : 'even'}">
				<td><input type="checkbox" name="items" value="${item.recommendationId}"></td>
				<td><c:out value='${item.userId}'/>&nbsp;</td>
				<td><c:out value='${item.createTimeString}'/>&nbsp;</td>
				<td><c:out value='${item.state}'/>&nbsp;</td>
				<td><c:out value='${item.name}'/>&nbsp;</td>
				<td><c:out value='${item.author}'/>&nbsp;</td>
				<td><c:out value='${item.publisher}'/>&nbsp;</td>
				<td><c:out value='${item.publishTimeString}'/>&nbsp;</td>
				<td><c:out value='${item.reason}'/>&nbsp;</td>
				<td><c:out value='${item.price}'/>&nbsp;</td>
				<td><c:out value='${item.remark}'/>&nbsp;</td>
				<td><c:out value='${item.source}'/>&nbsp;</td>
				<td><c:out value='${item.isbnorIssn}'/>&nbsp;</td>
				<td>
					<a href="${ctx}/recommendation/${item.recommendationId}">查看</a>&nbsp;&nbsp;
					<a href="${ctx}/recommendation/${item.recommendationId}/edit">修改</a>&nbsp;&nbsp;
					<a href="${ctx}/recommendation/${item.recommendationId}" onclick="doRestDelete(this,'你确认删除?');return false;">删除</a>
				</td>
			  </tr>
			  
		  	  </c:forEach>
		  </tbody>
		</table>
	
		<simpletable:pageToolbar page="${page}">
		</simpletable:pageToolbar>
		
	</div>
	</form>
</rapid:override>
<rapid:override name="script">
	<script></script>
</rapid:override>
<%@ include file="base.jsp" %>
